/**
 * 
 */
package com.dalonedrow.engine.ui.base.border;

import com.dalonedrow.engine.sprite.base.SimpleDimension;
import com.dalonedrow.engine.ui.base.GuiComponentImpl;

/**
 * Component border class.
 * @author Donald
 */
public abstract class GuiBorder extends GuiComponentImpl {
	/** the component's id. */
	private int			id;
	/** the <code>GuiBorder</code>'s preferred size. */
	private SimpleDimension	preferredSize	= new SimpleDimension(0, 0);
	/**
	 * {@inheritDoc}
	 */
	@Override
	public int getId() {
		return id;
	}
	/**
	 * Sets the component's id.
	 * @param val the id to set
	 */
	public final void setId(final int val) {
		this.id = val;
	}
	/**
	 * {@inheritDoc}
	 */
	@Override
	public SimpleDimension getPreferredSize() {
		return preferredSize;
	}
	/**
	 * {@inheritDoc}
	 */
	@Override
	public void setPosition(final double x, final double y, final double z) {
		super.setPosition(x, y, z);
		if (super.getSprite() != null) {
			super.getSprite().setPosition(x, y, z);
		}
	}
	/**
	 * {@inheritDoc}
	 */
	@Override
	public void setPreferredSize(final int width, final int height) {
		preferredSize.width = width;
		preferredSize.height = height;
		if (super.getSprite() != null) {
			super.getSprite().setWidth(preferredSize.width);
			super.getSprite().setHeight(preferredSize.height);
		}
	}
}
